package Decorator;

import component.FastFood;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public abstract class Garnish extends FastFood {

    //声明快餐类变量
    private FastFood fastFood;

    public Garnish(float price, String desc, FastFood fastFood) {
        super(price, desc);
        this.fastFood = fastFood;
    }


    public float cost() {
        //培根的价格加主食的价格
        return getFastFood().cost() + super.getPrice();
    }

    public String getDesc() {
        return super.getDesc() + getFastFood().getDesc();
    }
}
